class Person {
  protected name: string
  private age: number
  constructor(name: string, age: number) {
    this.name = name
    this.age = age
  }
  // 私有方法,只有在内部才能访问
  private eating() {
    console.log("吃东西", this.age, this.name)
  }
}

const p = new Person("why", 18)
console.log(p.name, p.age)
p.name = "kobe"
p.eating()

class Student extends Person {
  studying() {
    console.log("学习", this.age, this.name)
  }
}